#!/usr/bin/env python
#-*- coding:utf-8 -*-
'''
__author-default__ = 'Pup--->>WX_l599p22'
__cttime-default__ = '20170721'
'''

from flask_script import Manager
from app import app,db
from models import User

manager = Manager(app)

@manager.command
def create():
	# user = User.create()
	# return user
	db.create_all()


@manager.command
def save():
	# user = User(1,'admin')
	# user.save()
	user = User(2, 'admin2')
	db.session.add(user)
	db.session.commit()

@manager.command
def query_all():
	# users = User.query_all()
	# for user in users:
	# 	print user
	users = User.query.all()
	for user in users:
		print user

if __name__=='__main__':
	manager.run()